package com.sctvcloud.beichuan.ui.dialog;

import android.app.Dialog;
import android.os.Bundle;
import android.os.Message;
import android.support.annotation.Nullable;
import android.text.Html;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jiongbull.jlog.JLog;
import com.ruihang.generalibrary.ui.dialog.BaseDialogFragment;
import com.ruihang.generalibrary.ui.widget.CustomFontTextView;
import com.sctvcloud.beichuan.R;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ProtocolFragment extends BaseDialogFragment  implements View.OnClickListener{

    TextView tv_sure;

    private TextView tv_protocol_1;
    private TextView tv_protocol_2;
    private TextView tv_protocol_3;
    private TextView tv_protocol_4;
    private TextView tv_protocol_5;
    private TextView tv_protocol_6;
    private TextView tv_title;

    public ProtocolFragment() {

    }


    @Override
    protected int getContentRes() {
        return R.layout.dia_protocol_fragment;
    }

    @Override
    protected void initViews(Dialog dialog, Bundle savedInstanceState) {
        tv_sure = (TextView) dialog.findViewById(R.id.tv_sure);
        tv_sure.setOnClickListener(this);

        tv_protocol_1 = (TextView)dialog.findViewById(R.id.tv_protocol_1);
        tv_protocol_2 = (TextView)dialog.findViewById(R.id.tv_protocol_2);
        tv_protocol_3 = (TextView)dialog.findViewById(R.id.tv_protocol_3);
        tv_protocol_4 = (TextView)dialog.findViewById(R.id.tv_protocol_4);
        tv_protocol_5 = (TextView)dialog.findViewById(R.id.tv_protocol_5);
        tv_protocol_6 = (TextView)dialog.findViewById(R.id.tv_protocol_6);
        tv_title =  (TextView)dialog.findViewById(R.id.tv_title);
        if (getArguments() != null) {
            setTv_protocol_1(getArguments().getString("1"));
            setTv_protocol_2(getArguments().getString("2"));
            setTv_protocol_3(getArguments().getString("3"));
            setTv_protocol_4(getArguments().getString("4"));
            setTv_protocol_5(getArguments().getString("5"));
            setTv_protocol_6(getArguments().getString("6"));
            setTitle(getArguments().getString("title"));
        }


    }


    @Override
    public void onClick(View v) {
        if (v == tv_sure) {
            dismissAllowingStateLoss();
        }
    }


    public void setTv_protocol_1(String txt){
        if(null!=tv_protocol_1) {
            tv_protocol_1.setText(txt);
            tv_protocol_1.setVisibility(View.VISIBLE);
        }
    }

    public void setTv_protocol_2(String txt){
        if(null!=tv_protocol_2) {
            tv_protocol_2.setText(txt);
            tv_protocol_2.setVisibility(View.VISIBLE);
        }
    }
    public void setTv_protocol_3(String txt){
            if(null!=tv_protocol_3) {
                tv_protocol_3.setText(txt);
                tv_protocol_3.setVisibility(View.VISIBLE);
            }
    }
    public void setTv_protocol_4(String txt){
            if(null!=tv_protocol_4) {
            tv_protocol_4.setText(txt);
            tv_protocol_4.setVisibility(View.VISIBLE);
      }
    }
    public void setTv_protocol_5(String txt){
            if(null!=tv_protocol_5) {
                tv_protocol_5.setText(txt);
                tv_protocol_5.setVisibility(View.VISIBLE);
            }
    }
    public void setTv_protocol_6(String txt) {
        if (null != tv_protocol_6) {
            tv_protocol_6.setText(txt);
            tv_protocol_6.setVisibility(View.VISIBLE);
         }
    }
    public void setTitle(String txt) {
        if (null != tv_title) {
            tv_title.setText(txt);
            tv_title.setVisibility(View.VISIBLE);
        }
    }

}
